<template>
  <div class="wraper">
  <swiper :options="swiperOption" ref="mySwiper">
    <!-- slides -->
    <swiper-slide v-for="item of list" :key="item.id ">
        <img class="swiper-image" :src="item.imgUrl" alt="" />
    </swiper-slide>
    
  </swiper>
  </div>

</template>

<script>
export default {
  name: "HomeSwiper",
  props:{
    list:Array
  },
  data() {
    return {
      swiperOption: {
          pagination:{el: '.swiper-pagination'},
         autoplay:true,
      }
    }
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.swiper;
    }
  },
  mounted() {
    // current swiper instance
    // 然后你就可以使用当前上下文内的swiper对象去做你想做的事了
    console.log("this is current swiper instance object", this.swiper);
    this.swiper.slideTo(3, 1000, false);
  }
};
</script>
<style lang="stylus" scoped>
@import '~styles/varibles.styl';
.wraper>>> .swiper-pagination-bullet-active
      background-color #fff
.wraper
//图片占不抖动
  width 100%
  height 0
  overflow hidden
  padding-bottom 26.7%
  background #ffffff

  .swiper-image
    width: 100%;

 
</style>



